package com.onemile.app;

import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.onemile.app.base.BaseUI;
import com.onemile.data.DXml;
import com.onemile.data.DXmlHead;
import com.onemile.entity.PubConst;
import com.onemile.entity.Session;
import com.onemile.net.HttpClient;
import com.onemile.net.NetClient;
import com.onemile.utils.UtiDialogsFactory;

public class UITest extends BaseUI
{

   @Override
   protected void onCreateOverride(Bundle savedInstanceState)
   {
	  executeAsyncTask("x");
   }

   @Override
   public int SetContentViewLayoutResId()
   {

	  return R.layout.account;
   }

   @Override
   public void SetTopToolbar(TextView topTxt, ImageView leftImBtn, ImageView rightImgBtn, RelativeLayout rightRay, TextView cartNum)
   {
	  SetTopSytle(1);

   }

   /**
    * 
    * @param SystemId
    * @return
    */
   public static DXml GetRepairsDetails(String SystemId)
   {
	  try
	  {
		 DXml data = new DXml();
		 data.AddHead(new DXmlHead("MC0004"));
		 data.getBody().AddField("SystemId", SystemId);

		 String xml = HttpClient.sendMessage("http://119.97.213.242:10000/MobileApi.aspx", data.toBytes());
		 if (xml != null && !xml.equals(""))
		 {
			return new DXml(xml);
		 }
		 else
		 {
			return null;
		 }
	  }
	  catch (Exception e)
	  {
		 if (Session.getInstance().IsDEBUG())
		 {
			Log.e("ERROR", "NetClient_GetRepairsDetails(SystemId) ", e);
		 }
	  }
	  return null;
   }
   
   @Override
   public void onAsyncTaskStart(String taskName, Object[] params)
   {

   }

   @Override
   public Object onAsyncTaskInBackground(String taskName, Object[] params) throws Exception
   {
	  if (taskName.equals("x"))
	  {
		 return GetRepairsDetails("4190");
	  }
	  return null;
   }

   @Override
   public void onAsyncTaskEnd(String taskId, String taskName, Object[] params, Object result)
   {
	  DXml data = (DXml) result;

   }

}
